package com.sh.rabbitmq;

import com.rabbitmq.client.Channel;
import com.sh.rabbitmq.utils.ChannelFactory;

import java.util.Scanner;

public class Producer {

    public static final String QUEUE_NAME = "ack";

    public static void main(String[] args) throws Exception {
        Channel channel = ChannelFactory.getChannel();

        channel.queueDeclare(QUEUE_NAME, false, false, false, null);


        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            String next = sc.next();
            channel.basicPublish("", QUEUE_NAME, null, next.getBytes("utf-8"));
            System.out.println("发送成功");
        }
    }
}
